/*
 * Maze.h
 *
 *  Created on: 23.11.2011
 *      Author: jan
 */

#ifndef MAZE_H_
#define MAZE_H_

#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <iostream>
#include "Point.h"
#include "MathUtil.h"

#define PIC_WIDTH 500
#define PIC_HEIGHT 500

namespace std {

class Maze {
public:
	int height;
	int width;
	int update_cnt;
	vector<vector <int> > data;
	vector<Point> beacons;
	vector<Point> blocks;
	IplImage * img;
	bool imageShown;
	int wDiff;
	int hDiff;

	Point random_place();
	void draw();
	void redraw();
	void repaint();
	void drawRobot(Point r);
	void drawParticles(Point p);
	Maze(int date[], int h, int w);
	bool is_in(Point p);
	void releaseImage();
	double read_sensor();
	Point random_free_place();
	static double distance(Point p1, Point p2);
	double distance_to_nearest_beacon(Point p);
	bool is_free(Point p);
	virtual ~Maze();
};

} /* namespace std */
#endif /* MAZE_H_ */
